﻿<phone:PhoneApplicationPage 
    x:Class="Notes.EditPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape"  Orientation="Portrait" 
    shell:SystemTray.IsVisible="True"
    OrientationChanged="PhoneApplicationPage_OrientationChanged">

    <shell:SystemTray.ProgressIndicator>
        <shell:ProgressIndicator IsIndeterminate="True" Text="loading" IsVisible="{Binding IsProgressVisible}" />
    </shell:SystemTray.ProgressIndicator>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>

        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
			<TextBlock x:Name="PageTitle" Text="{Binding Path=LocalizedResources.strTitleApp, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
        </StackPanel>

        <TextBox x:Name="ContentTitle" Grid.Row="1" Text="{Binding Note.Title}" TextWrapping="Wrap"/>
        <ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="2">
            <TextBox AcceptsReturn="True" x:Name="ContentText" Text="{Binding Note.Text}" TextWrapping="Wrap" />
        </ScrollViewer>

        <ListBox Visibility="Visible" ItemsSource="{Binding Photos}" Grid.Row="3" x:Name="ImagesListBox" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionChanged="ImagesListBox_SelectionChanged">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Width="90" Height="90" Margin="10">
                        <StackPanel.Background>
                            <ImageBrush ImageSource="{Binding Bitmap}" Stretch="UniformToFill" />
                        </StackPanel.Background>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

	</Grid>
 
    <phone:PhoneApplicationPage.ApplicationBar>
		<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar.image.select.png" Click="ApplicationBarImage_Click" Text="Select"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar.delete.rest.png" Click="ApplicationBarDel_Click" Text="Delete"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>